@layout("/common/_container.html"){
<div class="row" xmlns="">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>代码生成</h5>
            </div>
            <div class="ibox-content" id="vueapp">
                <div class="row row-lg">
                    <div class="col-sm-12">
                        <div class="form-horizontal" id="generate">
                            <div class="row">
                                <div class="col-sm-4">
                                    <#input id="projectPath" name="项目路径" value="${params.projectPath}"/>
                                </div>
                                <div class="col-sm-4">
                                    <#input id="projectPackage" name="项目的包" value="${params.projectPackage}"/>
                                </div>
                                <div class="col-sm-4">
                                    <#input id="corePackage" name="核心包" value="${params.corePackage}"/>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-sm-3">
                                    <#input id="author" name="作者" value="bobo"/>
                                </div>
                                <div class="col-sm-3">
                                    <#input id="bizName" name="业务名称" />
                                </div>
                                <div class="col-sm-3">
                                    <#input id="moduleName" name="模块名称" value="${params.moduleName}"/>
                                </div>
                                <div class="col-sm-3">
                                    <#input id="parentMenuName" name="父级菜单名称" underline="false" value="${params.parentMenuName}"
                                            hidden="pid" readonly="readonly"
                                            clickFun="Code.showMenuSelectTree(); return false;"
                                            style="background-color: #ffffff !important;"
                                            selectFlag="true" selectId="pcodeTreeDiv" selectTreeId="pcodeTree" selectStyle=""/>
                                </div>
                            </div>

                            <div class="row">
                                <div class="col-sm-3">
                                    <#input id="tableName" name="表名称" disabled="disabled"/>
                                </div>
                                <div class="col-sm-3">
                                    <#input id="ignoreTabelPrefix" name="表前缀" value="${params.ignoreTabelPrefix}"/>
                                </div>
                                <div class="col-sm-3">
                                    <#input id="className" name="类名" />
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-sm-6">
                                    <button id="genBtn" type="button" class="btn btn-primary mr10"
                                            onclick="Code.generate()">
                                        <span style="padding: 5px 20px;">生成</span>
                                    </button>
                                </div>
                            </div>
                        </div>
                        <div style="padding-top: 10px; overflow: hidden"
                             class="container-fluid">
                            <div class="col-md-12">
                                <div class="row admin-form">
                                    <div class="col-md-2">
                                        <h2>数据表</h2>
                                        <div class="list-group" id="tableList"
                                             data-bind="foreach: tables"
                                             style="height: 500px; overflow-y: scroll">
                                            @for(table in tables!){
                                                <a href="javascript:void(0)" class="list-group-item" tableName="${table.tableName}" onclick="Code.selectTable('${table.tableName}')">${table.tableName}-${table.tableComment}</a>
                                            @}
                                        </div>
                                    </div>
                                    
                                    <div class="col-md-8">
                                        <span><h2>字段</h2></span>
                                        <div class="list-group" id="fieldList"
                                             style="height: 500px; overflow-y: scroll">
                                             <table class="table ">
                                             <thead>
                                             	<tr>
                                             		<th>名称</th>
                                             		<th>数据库字段</th>
                                             		<th>java字段</th>
                                             		<th>数据库类型</th>
                                             		<th>java类型</th>
                                             		<th>可空</th>
                                             		<th>可编辑</th>
                                             		<th>列表显示</th>
                                             		<th>查询条件</th>
                                             		<th>查询类型</th>
                                             		<th>查询方式</th>
                                             		<th>字典类型</th>
                                             		<th>排序</th>
                                             	</tr>
                                             	</thead>
                                             	<tbody>
                                             	<tr v-for="field in fieldList">
                                             		<td>{{ field.comments }}</td>
                                             		<td>{{ field.name }}</td>
                                             		<td>{{ field.javaField }}</td>
                                             		<td>{{ field.jdbcType }}</td>
                                             		<td>{{ field.javaType }}</td>
                                             		<td><input type="checkbox" checked v-model="field.isNull"/></td>
                                             		<td><input type="checkbox" checked v-model="field.isEdit"/></td>
                                             		<td><input type="checkbox" v-model="field.isList"/></td>
                                             		<td><input type="checkbox" v-model="field.isQuery"/></td>
                                             		<td>
	                                             		<select v-model="field.queryType">
	                                             			<option value="1" selected>等于</option>
	                                             			<option value="2">大于</option>
	                                             			<option value="3">小于</option>
	                                             			<option value="4">区间</option>
	                                             			<option value="5">全模糊</option>
	                                             			<option value="6">左模糊</option>
	                                             			<option value="7">右模糊</option>
	                                             		</select>
                                             		</td>
                                             		<td>
                                             			<select v-model="field.showType">
	                                             			<option value="1" selected>文本</option>
	                                             			<option value="2">文本域</option>
	                                             			<option value="3">时间</option>
	                                             			<option value="4">字典</option>
	                                             			<option value="5">单选</option>
	                                             			<option value="6">复选</option>
	                                             			<option value="7">地址</option>
	                                             		</select>
                                             		</td>
                                             		<td>
                                             			<select v-model="field.dictType">
	                                             			<option v-for="di in dictList">{{ di.type }}</option>
	                                             		</select>
                                             		</td>
                                             		<td>
                                             			<select v-model="field.sort">
	                                             			<option value="0"></option>
	                                             			<option value="1">升序</option>
	                                             			<option value="2">降序</option>
	                                             		</select>
                                             		</td>
                                             	</tr>
                                             	</tbody>
                                             </table>
                                        </div>
                                    </div>
                                    <div class="col-md-2">
                                        <span><h2>模板</h2></span>
                                        <div class="list-group" id="templateList"
                                             style="height: 500px; overflow-y: scroll">
                                            @for(template in templates!){
                                                <a href="javascript:void(0)" class="list-group-item" ikey="${template.key}" onclick="Code.selectTemplate('${template.key}')">${template.desc}</a>
                                            @}
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <ul class="nav nav-list">
                            <li class="divider"></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="${ctxPath}/static/js/common/select-list-object.js"></script>
<script src="${ctxPath}/static/modular/code/gen.js"></script>
@}

